package com.递归2;

import com.二叉树2.TreeNode;

public class 二叉树的最大深度 {
   public static class Solution {
        public static int maxDepth(TreeNode root) {
            if (root == null) {
                return 0;
            } else {
                int left_height = maxDepth(root.left);
                int right_height = maxDepth(root.right);
                return java.lang.Math.max(left_height, right_height) + 1;
            }
        }

       public static void main(String[] args) {
           TreeNode node = new TreeNode(new int[]{1,2});
           System.out.println(maxDepth(node));
       }
    }
}
